package org.wenhua.yuan.uilib

import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView

abstract class UIDataItem<DATA, ViewH:RecyclerView.ViewHolder> (data: DATA? = null) {
    val TAG = UIDataItem::class.java.simpleName
    var data:DATA? = null
    var adapter:UIAdapter? = null

    init {
        this.data = data
    }

    open fun getItemResource ():Int {
        return -1;
    }
    open fun getItemView(parent: ViewGroup): View? {
        return null
    }

    open fun setUIAdapter(adapter:UIAdapter) {
        this.adapter = adapter;
    }

//    open fun refreshListItem () {
//        this.adapter?.let {
//            it.refreshListItem(this)
//        }
//    }


    abstract fun onBindViewHolderInChild (position:Int, viewHolder:ViewH)
}